<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>登录页面</title>
		<link rel="stylesheet" href="../css/index.css" />
		<script type="text/javascript" src="../js/Size.js" ></script>
		<script type="text/javascript" src="../js/jquery-1.7.2.min.js" ></script>
	</head>
	<body class="box">
		<div class="center">
			<div class="left">
				<img src="../images/11.jpg" />
			</div>
			<div class="right">
				<div class="content">
					<p>人事管理系统</p>
					<p><label>用户名：</label><input type="text" id="username"></p>
					<p><label>密码：</label><input type="password" id="passWord"></p>
					<p><button onclick="login()">登录</button><button>重置</button></p>
				</div>
			</div>
		</div>
	</body>
</html>
<script type="application/javascript">
	function login(){
		var url = "/admin/login";
		var username = $("#username").val();
		var passWord = $("#passWord").val();
		if(username != '' && passWord != ''){
			$.ajax({
				type: "POST",
				url: url,
				dataType: "text",
				data: {
					"username": username,
					"passWord": passWord
				},
				success: function (data) {
					console.log(data)
					if ("true" == data) {
						window.location.href='/index'
					}else{
						console.log("密码错误!");
					}
				},
				error: function (data) {
				}
			});
		}
	}
</script>